﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Servicios.Data.DataBases.Biblioteca
{
    public partial class AutorDTO
    {
        public override string ToString()
        {
            return string.Format("{0}, {1}", Apellidos, Nombres);
        }

        #region IDataTransferObject<AutorDTO> Members

        public List<AutorDTO> GetAll()
        {
            throw new NotImplementedException();
        }

        public AutorDTO GetByID(int id)
        {
            using (BibliotecaContext bib = new BibliotecaContext())
            {
                var q = from au in bib.AutorSet where au.ID == id select au;
                return q.FirstOrDefault();
            }
        }

        public void Save()
        {
            using (BibliotecaContext bib = new BibliotecaContext())
            {
                bib.AddToAutorSet(this);
                bib.SaveChanges();
            }
        }



        public void Update()
        {
            throw new NotImplementedException();
        }

        public void Delete()
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
